%{ %}

%token  EOF 
%token  <float> NUMBER 
%token  <int> INTCONST
%token  <string> IDENTIFIER 
%token  NUMTYPE
%token  STRTYPE
%token  ROWTYPE
%token  COLTYPE
%token  ADD
%token  SUBTRACT
%token  MULTIPLY
%token  DIVIDE
%token  ASSIGN        
%token  LESSTHAN
%token  GREATERTHAN
%token  LESSTHAN
%token  EQUALS
%token  SIZE
%token  CURRINDEX
%token  IF
%token  ELSE
%token  LEFTPARAN
%token  RIGHTPARAN
%token  LEFTSQPARAN
%token  LEFTPARAN
%token  BLOCKBEGIN
%token  BLOCKEND
%token  LOOP
%token  FUNCTION
%token  COL_HEADING
%token  ROW_HEADING
%token  ROW_LIMIT
%token  COL_LIMIT
%token  ROW_FILTER_CONDITION
%token  COL_SORT_INDEX
%token  RETURN	



%left   <float> NUMBER 
%left   <int> INTCONST 
%left   NUMTYPE
%left   STRTYPE
%left   ROWTYPE
%left   COLTYPE
%left   ASSIGN        
%left   SIZE
%left  CURRINDEX
%left   IF
%left  ELSE
%left   LEFTPARAN
%left RIGHTPARAN
%left LEFTSQPARAN
%left LEFTPARAN
%left BLOCKBEGIN
%left BLOCKEND
%left LOOP
%left FUNCTION
%left COL_HEADING
%left ROW_HEADING
%left ROW_LIMIT
%left COL_LIMIT
%left ROW_FILTER_CONDITION
%left COL_SORT_INDEX
%left RETURN	
%left   <string> IDENTIFIER 

%type <unit> expr
%start expr

%%

expr:   NUMBER {print_string "NUMBER "; flush stdout}
|  INTCONST {print_string "INTCONST"; flush stdout}
|  IDENTIFIER {print_string "IDENTIFIER " ; print_string $1; flush stdout}
|  NUMTYPE {print_string "NUMTYPE " ; flush stdout}
|  STRTYPE {print_string "STRTYPE " ; flush stdout}
|  ROWTYPE {print_string "ROWTYPE " ; flush stdout}
|  COLTYPE {print_string "COLTYPE " ; flush stdout}
|  ADD {print_string "ADD" ; flush stdout}
|  SUBTRACT {print_string "SUBTRACT" ; flush stdout}
|  MULTIPLY{print_string "MULTIPLY" ; flush stdout}
|  DIVIDE{print_string "DIVIDE" ; flush stdout}
|  ASSIGN  {print_string "ASSIGN " ; flush stdout}        
|  LESSTHAN{print_string "LESSTHAN " ; flush stdout}
|  GREATERTHAN{print_string "GREATERTHAN " ; flush stdout}
|  EQUALS{print_string "EQUALS " ; flush stdout}
|  SIZE {print_string "SIZE "; flush stdout}
|  CURRINDEX {print_string "CURRINDEX " ; flush stdout}
|  IF {print_string "IF " ; flush stdout}
|  ELSE {print_string "ELSE " ; flush stdout}
|  LEFTPARAN {print_string "LEFTPARAN " ; flush stdout}
|  RIGHTPARAN {print_string "RIGHTPARAN "; flush stdout}
|  LEFTSQPARAN {print_string "LEFTSQPARAN " ; flush stdout}
|  BLOCKBEGIN {print_string "BLOCKBEGIN "; flush stdout}
|  BLOCKEND {print_string "BLOCKEND "; flush stdout}
|  LOOP {print_string "LOOP "; flush stdout}
|  FUNCTION {print_string "FUNCTION "; flush stdout}
|  COL_HEADING {print_string "COL_HEADING "; flush stdout}
|  ROW_HEADING {print_string "ROW_HEADING "; flush stdout}
|  ROW_LIMIT {print_string "ROW_LIMIT "; flush stdout}
|  COL_LIMIT {print_string "COL_LIMIT "; flush stdout}
|  ROW_FILTER_CONDITION {print_string "ROW_FILTER_CONDITION "; flush stdout}
|  COL_SORT_INDEX {print_string "COL_SORT_INDEX "; flush stdout}
|  RETURN	 {print_string "RETURN "; flush stdout}
;

%%

